package com.zxy.supplier_system.server.entity

import jakarta.persistence.*
import org.hibernate.annotations.DynamicInsert
import org.hibernate.annotations.DynamicUpdate
import org.springframework.data.annotation.CreatedBy
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.time.OffsetDateTime

@Entity
@EntityListeners(AuditingEntityListener::class)
@DynamicUpdate
@DynamicInsert
class GoodsInventoryRecord {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    var id:Int = 0

    @CreatedDate
    lateinit var createdDateTime: OffsetDateTime

    @CreatedBy
    @ManyToOne(optional = false)
    @JoinColumn
    lateinit var createdBy:Employee

    var completedDateTime:OffsetDateTime? = null

}